<template>
  <view class="flex flex-col w-full">
    <view
      v-for="(service, index) in services"
      :key="index"
      class="flex row justify-between w-full items-center"
    >
      <view class="flex-1">服务{{ index }}</view>

      <view
        v-for="(characteristic, index1) in service.charList"
        :key="`${index}-${index1}`"
        class="flex row justify-between w-100rpx text-24rpx b"
      >
        <view @click="setCharacteristic(service, characteristic)"
          >信息{{ index1 }}</view
        >
      </view>
    </view>
  </view>
</template>
<script setup>
import { ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";

const services = ref([]);

const setCharacteristic = (service, characteristic) => {
  console.log(service, characteristic);
  uni.setStorageSync("serviceId", service.uuid);
  uni.setStorageSync("characteristicId", characteristic.uuid);

  uni.navigateTo({
    url: "/pages/classic/index",
  });
};

onLoad((options) => {
  services.value = uni.getStorageSync("services") || [];
});
</script>
<style>
.w-100rpx {
  width: 100rpx;
}
.text-24rpx {
  font-size: 24rpx;
}
.b {
  border: 1px solid #333;
}
</style>
